<?php

namespace IDock\Insurance\ZFIC\Response;

use IDock\Http\Response;
use IDock\Insurance\ZFIC\Response\AllZFICResponse;
use IDock\Printer\UploadFilePrinter;

class UploadFileResponse extends AllZFICResponse
{

    public function printerInit(): Response
    {
        $uploadFilePrinter = new UploadFilePrinter();

        $this->printer = $uploadFilePrinter;

        $data = $this->getBody();
        if(is_string($data)){
            $data = json_decode($data,true);
        }
        if($data['state'] != '200'){
            $this->setError($data['msg']);
        }

        return $this;
    }
}
